namespace Test.ConsoleProgram.Algorithm.Interview
{
    [TestDescription("面试题 16.11. 跳水板")]
    public class No00160011_DivingBoard : AbsBaseTestItem
    {
        public override void OnTest()
        {
            Assert.TestExe(DivingBoard, 1, 2, 3, new int[] { 3, 4, 5, 6 });
        }

        public int[] DivingBoard(int shorter, int longer, int k)
        {
            if (k == 0)
            {
                return new int[0];
            }
            if (shorter == longer)
            {
                return new int[] { shorter * k };
            }
            int[] result = new int[k + 1];
            for (int i = 0; i <= k; i++)
            {
                result[i] = shorter * (k - i) + longer * i;
            }
            return result;
        }
    }
}
